﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    interface ISwim {
        void Swim();
    }
    interface ITree {
        void Tree();
    }
    abstract class  Animal {
        private string name;
        public string Name { get { return name; } set { name = value; } }
        public Animal() { }
        public Animal(string name) {
            this.name = name;
        }
        public abstract void Eat();
    
    }
    class Cat : Animal, ITree
    {
        public override void Eat()
        {
            Console.WriteLine("{0}会吃鱼",this.Name);
        }

        public void Tree()
        {
            Console.WriteLine("{0}会爬树",this.Name);
        }
    }
    class Dog : Animal,ISwim
    {
        public override void Eat()
        {
            Console.WriteLine("{0}会吃骨头", this.Name);
        }

        public void Swim()
        {
            Console.WriteLine("{0}会游泳",this.Name);
        }

    }

    class Duck : Animal, ISwim
    {
        public override void Eat()
        {
            Console.WriteLine("{0}会吃小鱼，小虾或者昆虫谷物", this.Name);
        }

        public void Swim()
        {
            Console.WriteLine("{0}会游泳", this.Name);
        }
    }

    class Monkey : Animal, ITree
    {
        public override void Eat()
        {
            Console.WriteLine("{0}会吃桃子", this.Name);
        }

        public void Tree()
        {
            Console.WriteLine("{0}会爬树", this.Name);
        }
    }


    class Program
    {
            static void Main(string[] args)
            {
            Cat cat = new Cat();
            cat.Name = "猫";
            cat.Eat();
            cat.Tree();

            Console.WriteLine();

            Dog dog = new Dog();
            dog.Name = "狗";
            dog.Eat();
            dog.Swim();

            Console.WriteLine();

            Duck duck = new Duck();
            duck.Name = "鸭子";
            duck.Eat();
            duck.Swim();

            Console.WriteLine();

            Monkey monkey = new Monkey();
            monkey.Name = "猴子";
            monkey.Eat();
            monkey.Tree();

            }
    }
}

